From 9652e9b451e7055fb8a11f74a39f719d150cc653 Mon Sep 17 00:00:00 2001 From: "vhanquez@kneesa.uk.xensource.com" Date: Mon, 9 Jan 2006 13:11:55 +0000 Subject: [PATCH] free trans if allocated, if dev_request_and_reply fail. Signed-off-by: Vincent Hanquez --- linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c index e175b4e9ea..b7a7d892f5 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c @@ -109,7 +109,7 @@ static ssize_t xenbus_dev_write(struct file *filp, size_t len, loff_t *ppos) { struct xenbus_dev_data *u = filp->private_data; - struct xenbus_dev_transaction *trans; + struct xenbus_dev_transaction *trans = NULL; void *reply; if ((len + u->len) > sizeof(u->u.buffer)) @@ -141,8 +141,10 @@ static ssize_t xenbus_dev_write(struct file *filp, } reply = xenbus_dev_request_and_reply(&u->u.msg); - if (IS_ERR(reply)) + if (IS_ERR(reply)) { + kfree(trans); return PTR_ERR(reply); + } if (u->u.msg.type == XS_TRANSACTION_START) { trans->handle = (struct xenbus_transaction *) -- 2.30.2